<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //     5.keys()对键名的遍历,values() ,entries()对键值对的遍历，返回一个遍历器  可以使用for...of循环进行
        let arr = [3,5,7,9];
        // console.log(arr.keys());
        //遍历键
        // for (const index of arr.keys()) {
        //     console.log(index);
        // }
        //遍历值
        // for (const index of arr.values()) {
        //     console.log(index);
        // }
        // console.log(arr.values());
        //遍历键值
        // for (const [k,v] of arr.entries()) {
        //         console.log(k,v);
        //     }
        // let it = arr.entries()
        // console.log(it.next().value);
        // console.log(it.next().value);
        // console.log(it.next().value);
        // console.log(it.next());
        // console.log(it.next());
    //6.includes() 返回一个布尔值，表示一个数组是否包含给定的值
		// console.log([1,2,3].includes(2))
		console.log([1,2,3].includes("2"))
		console.log([1,2,3].includes(4))
		//和之前的方法indexOf()有点像
		console.log([1,2,3].indexOf(2))//返回索引1
		console.log([1,2,3].indexOf(4))//返回-1
    </script>
</body>
</html>